<?php
/**
 * Description of Home
 *
 * @author damianociarla
 */
class HomeController extends BXD_Abstract_Controller
{
	public function index()
	{
//		PluginEntityManager::generateEntity();

		$result = Bxd::plugins()->db()->count(new User)
		->join(new Content)
		->where("type")->equal("photo")
		->join(new GeometryExtra, "Content", "content.geometry_id = geometry_extra.geometry_id")
		->execute();

		var_dump($result);

		$result = Bxd::plugins()->db()->find(new User)
		->select("first_name, last_name, user_name")
		->join(new Content)
		->select("id, title, title_url")
		->where("type")->equal("photo")
		->join(new GeometryExtra, "Content", "content.geometry_id = geometry_extra.geometry_id")
		->select("country_ex, city, street")
		->limit(0, 1)
		->execute();

		var_dump($result);

//		->where("first_name")->equal("Damiano")
//		->join(new Content(), "Role", "role.id = content.role_id");

//		$user->first_name = "Damiano";
//		$user->last_name = "Ciarla";
//
//		var_dump($user->getProperty());
//		exit();

//		if(PluginEntityManager::count($user)->execute())
//		{
//			$user = new User();
//			$user->role_id = 1;
//			$user->first_name = "David";
//			$user->last_name = "Foliti";
//			$user->user_name = "iamimori";
//
//			PluginEntityManager::insert($user)->execute();
//
//			echo "ID: " . $user->id;
//		}


//		$user->first_name = "Damiano";
//		$user->last_name = "Ciarla";
//		$user->user_name = "damy863";
//		$lastID = PluginEntityManager::insert($user)->execute();

//		var_dump($result);

//		$user->first_name = "David";
//		$user->last_name = "Foliti";
//		$user->user_name = "q";
//		$result = PluginEntityManager::insert($user)->execute();

//		var_dump($result);

//		$result = PluginEntityManager::find(new User)
//		->select("first_name")
//		->where('first_name')->equal("David")
//		->limit(0, 1)
//		->execute(true);
//
//		var_dump($result);
	}
}
?>
